**# Bookmark #1 Setting

*Windows
global root  = "G:/Dropbox/Environmental Injustice/Empirical"
global rawdata = "$root/rawdata"
global workdata = "$root/workdata"
global results = "$root/results"
global outfile = "$root/outfile"

cd "$workdata"


**# Bookmark #2 Figure 2a: Population Share without College Education
*Firm-level COD Emission
use "$outfile/Firm_regression.dta",clear

forvalues i=2001/2010{
gen year`i'=(year==`i')
gen belowcl_Year`i'=belowcl*year`i'
}
	
reghdfe codemission belowcl_Year2001 belowcl_Year2002 belowcl_Year2003 belowcl_Year2004 o.belowcl_Year2005 belowcl_Year2006 belowcl_Year2007 belowcl_Year2008 belowcl_Year2009 belowcl_Year2010,absorb(i.id i.province#i.year) cluster(i.province i.year)
est store belowcl


coefplot belowcl, keep(belowcl_Year*) levels(95) omitted vertical ///
    xlabel(1 "2001" 2 "2002" 3 "2003" 4 "2004" 5 "2005" 6 "2006" 7 "2007" 8 "2008" 9 "2009" 10 "2010", ///
	labcolor(black)) ///
    recast(connected) lcolor(navy) lpattern(solid) lwidth(medthick) ///
    ciopts(recast(rcap) lcolor(%50) lwidth(thin)) ///
    mlcolor(navy) mfcolor(white) msize(medium) msymbol(oh) ///
	ylabel(,nogrid) ///
    yline(0, lcolor(gs10) lwidth(thin)) ///
    xline(5, lcolor(gs10) lpattern(dash)) ///
    ytitle("Coefficient") ///
	xtitle("(A) Population Share without College Education",size(large) margin(l-10 t+4 b-4)) ///
	graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white))

graph save "Graph" "$results/Figure 2a.gph", replace
graph export "$results/Figure 2a.png", as(png) name("Graph") replace


**# Bookmark #2 Figure 2b: Population Share without High School Education
*Firm-level COD Emission
use "$outfile/Firm_regression.dta",clear

forvalues i=2001/2010{
gen year`i'=(year==`i')
gen belowhs_Year`i'=belowhs*year`i'
}
	
reghdfe codemission belowhs_Year2001 belowhs_Year2002 belowhs_Year2003 belowhs_Year2004 o.belowhs_Year2005 belowhs_Year2006 belowhs_Year2007 belowhs_Year2008 belowhs_Year2009 belowhs_Year2010,absorb(i.id i.province#i.year) cluster(i.province i.year)
est store belowhs

coefplot belowhs, keep(belowhs_Year*) levels(95) omitted vertical ///
    xlabel(1 "2001" 2 "2002" 3 "2003" 4 "2004" 5 "2005" 6 "2006" 7 "2007" 8 "2008" 9 "2009" 10 "2010", ///
	labcolor(black)) ///
    recast(connected) lcolor(navy) lpattern(solid) lwidth(medthick) ///
    ciopts(recast(rcap) lcolor(%50) lwidth(thin)) ///
    mlcolor(navy) mfcolor(white) msize(medium) msymbol(oh) ///
	ylabel(,nogrid) ///
    yline(0, lcolor(gs10) lwidth(thin)) ///
    xline(5, lcolor(gs10) lpattern(dash)) ///
    ytitle("Coefficient") ///
	xtitle("(B) Population Share without High School Education",size(large) margin(l-10 t+4 b-4)) ///
	graphregion(lcolor(white) color(white)) ///
    plotregion(margin(zero) color(white))

graph save "Graph" "$results/Figure 2b.gph", replace
graph export "$results/Figure 2b.png", as(png) name("Graph") replace

graph combine "$results/Figure 2a.gph" "$results/Figure 2b.gph", col(1) ///
graphregion(margin(t=2 b=2 l=0 r=1) lcolor(white) color(white)) plotregion(margin(zero) color(white))
graph export "$results/Figure 2.pdf", as(pdf) name("Graph") replace
